﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Follow : MonoBehaviour {
    public Transform tagert;
    public float v = 2;
    [SerializeField]
    private Vector3 offset;
    private Transform trans;
    private void Awake()
    {
        offset = transform.localPosition - tagert.localPosition;
        trans = transform;
    }

    // Update is called once per frame
    void Update () {
        Vector3 detaMove = Vector3.Lerp(trans.localPosition, tagert.localPosition + offset, v*Time.deltaTime);
        trans.localPosition = detaMove;
	}
}
